<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/assets/octopus/engine/router.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\..\index.html">All files</a> / <a href="index.html">src/assets/octopus/engine</a> router.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/13</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/4</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/7</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/13</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105</td><td class="line-coverage quiet"><span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" >import $ from "jquery";</span>
&nbsp;
function <span class="fstat-no" title="function not covered" >oRouterEngine(engine) {</span>
<span class="cstat-no" title="statement not covered" >  this.engine = engine;</span>
  // 路由器，动态注册制、路由控制。
<span class="cstat-no" title="statement not covered" >  this.router = this.engine.vue.$router;</span>
  // 当前路由信息
<span class="cstat-no" title="statement not covered" >  this.route = this.engine.vue.$route;</span>
&nbsp;
}
&nbsp;
oRouterEngine.prototype = {
  // 需要在主函数rander中渲染，否则无法加载函数库，因为router的初始化是最前置的。
  init: <span class="fstat-no" title="function not covered" >function () </span>{
    // let o = this;
    // // 判断当前页面是否是未注册的，如果是，则WAIT_REG_URL会包含数据。
    // if (!this.engine.tools.IsNullOrEmpty(this.getter().WAIT_REG_URL)) {
    //   // 此处base64.encode有个bug。。就是输入的字符串如果是[.../?...]，里面的斜杠不会被转移。。导致url看起来多了一层。。。fuck。。。
    //   let base64_url = this.engine.tools.base64.encode(this.getter().WAIT_REG_URL);
    //   let me_url = "/ESB/Security/Permission/Module/Exists/?url=" + base64_url;
    //   // 发起模块检测请求，如果有该菜单、地址，且当前账户有这个权限，则会返回200及权限列表，否则输出返回的异常。
    //   this.engine.request.api.get(me_url,
    //     // 处理回调事件，通过分析data.status.code的状态来实现。
    //     function (data) {
    //       console.log("模块鉴权：" + JSON.stringify(data));
    //       if (data.status.code == 200) {
    //         o.getter().URL_Data = data.content;// 保存菜单的ID，后续页面请求接口时要传到后台ESB用于当前页面下的当前接口的权限验证。
    //         o.getter().addRoutes([{
    //           path: o.getter().URL_Data.Module,
    //           name: 'DynamicModule',// 每个页面只会存在一个【动态模块】，所以统一名字。
    //           component: require('@/components' + o.getter().URL_Data.Module).default
    //         }]);
    //         // 虽然数据库是模糊匹配，但是前端是严格按照请求URL回调的，所以如果注册的模块和请求的地址不一样，也是不能访问的。
    //         o.getter().push({path: o.getter().WAIT_REG_URL});
    //       }
    //       else {
    //         // 如果没有匹配到，则跳转404页面。
    //         // let NotFound = "/Base/NotFound";
    //         // 404页面是预先注册的。
    //         // o.getter().addRoutes([{
    //         //   path: NotFound,
    //         //   name: 'DynamicModule',// 每个页面只会存在一个【动态模块】，所以统一名字。
    //         //   component: require('@/components/Engine' + NotFound).default
    //         // }]);
    //         o.getter().push({path: "/Error/NotFound?url=" + base64_url});
    //       }
    //       // 清空，表示本次处理已完成。
    //       o.getter().WAIT_REG_URL = "";
    //     });
    // }
    // // 注册完成完整再跳转本页面，这个时候是含注册路由信息了，所以直接进入else的next()方法。
    // router.push({path: to.fullPath});
  },
  get: <span class="fstat-no" title="function not covered" >function () </span>{
<span class="cstat-no" title="statement not covered" >    return this.route;</span>
  },
  getter: <span class="fstat-no" title="function not covered" >function () </span>{
    // 切换时隐藏
    // $("[o-container-app]").fadeOut(1000);
    // $("[o-container-app]").css("display", "none");
    // $("[o-container-app]").animate({width:'0px'});
<span class="cstat-no" title="statement not covered" >    return this.router;</span>
  },
  // 更新路由route，非router。
  set: <span class="fstat-no" title="function not covered" >function (</span>r) {
<span class="cstat-no" title="statement not covered" >    this.route = r;</span>
  },
  // 设置跳转的目标路由，不同级别层级调用太麻烦，太复杂，由八爪鱼引擎统一处理。
  jump: <span class="fstat-no" title="function not covered" >function (</span>p) {
<span class="cstat-no" title="statement not covered" >    this.getter().push({path: p});</span>
  },
  // 指定的跳转到登陆页
  jumplogin:<span class="fstat-no" title="function not covered" >function () </span>{
    // 如果是移动端，则返回移动端的登陆页。
<span class="cstat-no" title="statement not covered" >    if(this.engine.tools.isMobile()){</span>
      //
      // try {
      //   window.webkit.messageHandlers.setLogin.postMessage(false);
      // }catch (e) {
      //   this.engine.tips.warning("未找到原生定义。");
      // }
      //
      // try {
      //   android.setLogin(false);
      // }catch (e) {
      //   this.engine.tips.warning("未找到原生定义。");
      // }
<span class="cstat-no" title="statement not covered" >      if(window.setLogin) {</span>
<span class="cstat-no" title="statement not covered" >        window.setLogin(true);</span>
      }
&nbsp;
<span class="cstat-no" title="statement not covered" >      this.jump("/admin/loginApp");</span>
    }else {
<span class="cstat-no" title="statement not covered" >      this.jump("/admin/login");</span>
    }
  },
&nbsp;
}
&nbsp;
export {
  oRouterEngine
}
&nbsp;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 17:54:15 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\..\sorter.js"></script>
</body>
</html>
